<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@taglib prefix="f" uri="/flowpage-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  	<title></title>
  <%@include file="/share/header.jsp"%>
  	<link href="<%=basePath %>css/blockright.css" rel="stylesheet" type="text/css"/>
<%--	<s:head/>--%>
	<f:header theme="${sessionScope.skinCon.pageSkin}"/>
	<style>
	html { overflow-x: hidden;  overflow-y: auto; }
	.over{
	 background:#CDE6FF;
	 color:#000000;
	}
	.tr_chouse{
	 color:#FFF;
	 background:#6AB1FF;
	}
	</style>
	<script type="text/javascript">
// JavaScript Document
$(document).ready(function(){
 var cellCount = $(".stripe tr").length!=0?$(".stripe tr").get(0).cells.length:0;
 $(".stripe tr").mouseover(function(){
  	if(this.childNodes.length<cellCount){
  		$(this).children().addClass("over");
  	}else{
  		$(this).find("td:gt(0)").addClass("over");
  	}
  }).mouseout(function(){
  	if(this.childNodes.length<cellCount){
  		$(this).children().removeClass("over");
  	}else{
  		$(this).find("td:gt(0)").removeClass("over");
  	}  	
  }).click(function(){
  	//$(this).toggleClass("tr_chouse");
  	if(this.childNodes.length<cellCount){
  		$(this).children().toggleClass("tr_chouse");
  	}else{
  		$(this).find("td:gt(0)").toggleClass("tr_chouse");
  	}  	  	
  })
});
</script>
  </head>

  
  
  <script type="text/javascript">
	String.prototype.startWith=function(str){     
	  var reg=new RegExp("^"+str);     
	  return reg.test(this);        
	} 
	<%--	xl 2011-08-04  修改全选功能，如果是编辑或查看全选其中之一，另外的将置灰--%>
	function isCheckedAll(obj,tagname)
	{
		
		if(obj.checked  == true)
		{
        	var i = 0;
			while(document.getElementsByTagName("INPUT")[i]!=null)
        	{
        		if(tagname=='isCheckedModify')
        		{
	        		if(document.getElementsByTagName("INPUT")[i].type=="checkbox"&&document.getElementsByTagName("INPUT")[i].name.startWith(tagname)&&document.getElementsByTagName("INPUT")[i].disabled!=true)
		        	{
	            		document.getElementsByTagName("INPUT")[i].checked=true;
	            	}
	            	if(document.getElementsByTagName("INPUT")[i].type=="checkbox"&&document.getElementsByTagName("INPUT")[i].name.startWith('isCheckedView')&&document.getElementsByTagName("INPUT")[i].checked!=true)
		        	{
	            		document.getElementsByTagName("INPUT")[i].disabled="true";
	            	}
	            }
	            else if(tagname=='isCheckedView')
        		{
	        		if(document.getElementsByTagName("INPUT")[i].type=="checkbox"&&document.getElementsByTagName("INPUT")[i].name.startWith(tagname)&&document.getElementsByTagName("INPUT")[i].disabled!=true)
		        	{
	            		document.getElementsByTagName("INPUT")[i].checked=true;
	            	}
	            	if(document.getElementsByTagName("INPUT")[i].type=="checkbox"&&document.getElementsByTagName("INPUT")[i].name.startWith('isCheckedModify')&&document.getElementsByTagName("INPUT")[i].checked!=true)
		        	{
	            		document.getElementsByTagName("INPUT")[i].disabled="true";
	            	}
	            }
	            else
	            {
	            	if(document.getElementsByTagName("INPUT")[i].type=="checkbox"&&document.getElementsByTagName("INPUT")[i].name.startWith(tagname)&&document.getElementsByTagName("INPUT")[i].disabled!=true)
		        	{
	            		document.getElementsByTagName("INPUT")[i].checked=true;
	            	}
	            }
	            i++;
	            
			}
		}
		else
		{
			var i = 0;
        	while(document.getElementsByTagName("INPUT")[i]!=null)
        	{
        		if(tagname=='isCheckedModify')
        		{
	        		if(document.getElementsByTagName("INPUT")[i].type=="checkbox"&&document.getElementsByTagName("INPUT")[i].name.startWith(tagname)&&document.getElementsByTagName("INPUT")[i].disabled!=true)
		        	{
		            	document.getElementsByTagName("INPUT")[i].checked=false;
		            }
	            	if(document.getElementsByTagName("INPUT")[i].type=="checkbox"&&document.getElementsByTagName("INPUT")[i].name.startWith('isCheckedView')&&document.getElementsByTagName("INPUT")[i].disabled==true)
		        	{
		        		
	            		document.getElementsByTagName("INPUT")[i].disabled="";
	            	}
	            }
	            else if(tagname=='isCheckedView')
        		{
	        		if(document.getElementsByTagName("INPUT")[i].type=="checkbox"&&document.getElementsByTagName("INPUT")[i].name.startWith(tagname)&&document.getElementsByTagName("INPUT")[i].disabled!=true)
		        	{
		            	document.getElementsByTagName("INPUT")[i].checked=false;
		            }
	            	if(document.getElementsByTagName("INPUT")[i].type=="checkbox"&&document.getElementsByTagName("INPUT")[i].name.startWith('isCheckedModify')&&document.getElementsByTagName("INPUT")[i].disabled==true)
		        	{
		        		
	            		document.getElementsByTagName("INPUT")[i].disabled="";
	            	}
	            }
	            else
	            {
	        		if(document.getElementsByTagName("INPUT")[i].type=="checkbox"&&document.getElementsByTagName("INPUT")[i].name.startWith(tagname)&&document.getElementsByTagName("INPUT")[i].disabled!=true)
		        	{
		            	document.getElementsByTagName("INPUT")[i].checked=false;
		            }
		        }  
	            i++;
			}
		}
	}
	<%--	xl 2011-08-04 勾选编辑复选框时查看框置灰--%>
	function isCheckedModify(obj,val)
	{
		if(obj.checked==true)
		{
			document.getElementById("isCheckedView"+val).disabled="true";
			
		}
		else
		{
			document.getElementById("isCheckedView"+val).disabled="";
		}
	}
<%--	xl 2011-08-04 勾选查看复选框时编辑框置灰--%>
	function isCheckedView(obj,val)
	{
		if(obj.checked==true)
		{
			document.getElementById("isCheckedModify"+val).disabled="true";
			
		}
		else
		{
			document.getElementById("isCheckedModify"+val).disabled="";
		}
	}
	

	</script>
  <body style="overflow:auto; ">
    <br>
    <s:actionerror/>
	<s:form action="saveRight" namespace="/system/roleblockright" id="RoleBlockRight">
	<s:hidden name="domain.roleId"></s:hidden>
<%--	<table>--%>
<%--	<tr>--%>
<%--		<s:iterator value="getCodeItemList('operation_right')">--%>
<%--		<td class="tdattribute"><span id="span_<s:property value="value"/>"><input type="checkbox" name="isChecked<s:property value="value"/>All" id="isChecked<s:property value="value"/>All" onclick="isCheckedAll(this,'isChecked<s:property value="value"/>');" > <s:property value="name"/></span></td>--%>
<%--		</s:iterator>--%>
<%--	</tr>--%>
<%--	</table>--%>
	<table width="100%" border="0" cellspacing="0" cellpadding="15">
		
		<tr>
        	<td>
	            <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" >
	            	<thead> 
	                <tr> 
	                    <td  class="tdtitle"  height="25" colspan="20" valign="middle">
	                    	角色模块操作权限设置
	                    </td>
	                </tr>
	                <tr>
	                	<td class="tdattributeleft" ><span>父模块名称</span></td>
						<td class="tdattribute" ><span>子模块名称</span></td>
						<td class="tdattribute"><span id="span_ADD"><input type="checkbox" name="isCheckedAddAll" id="isCheckedAddAll" onclick="isCheckedAll(this,'isCheckedAdd');" > 新增</span></td>
						<td class="tdattribute"><span id="span_MODIFY"><input type="checkbox" name="isCheckedModifyAll" id="isCheckedModifyAll" onclick="isCheckedAll(this,'isCheckedModify');" >修改</span></td>
						<td class="tdattribute"><span id="span_DEL"><input type="checkbox" name="isCheckedDelAll" id="isCheckedDelAll" onclick="isCheckedAll(this,'isCheckedDel');" >删除</span></td>
						<td class="tdattribute"><span id="span_VIEW"><input type="checkbox" name="isCheckedViewAll" id="isCheckedViewAll" onclick="isCheckedAll(this,'isCheckedView');" >查看</span></td>
						<td class="tdattribute"><span id="span_EDITSELECT"><input type="checkbox" name="isCheckedEditSelectAll" id="isCheckedEditSelectAll" onclick="isCheckedAll(this,'isCheckedEditSelect');" >编辑下拉框</span></td>
						<td class="tdattribute"><span id="span_IMPORTEXCEL"><input type="checkbox" name="isCheckedImportExcelAll" id="isCheckedImportExcelAll" onclick="isCheckedAll(this,'isCheckedImportExcel');" >导入Excel</span></td>
						<td class="tdattribute"><span id="span_EXPORTEXCEL"><input type="checkbox" name="isCheckedExportExcelAll" id="isCheckedExportExcelAll" onclick="isCheckedAll(this,'isCheckedExportExcel');" >导出Excel</span></td>
						<td class="tdattribute"><span id="span_COPY"><input type="checkbox" name="isCheckedCopyAll" id="isCheckedCopyAll" onclick="isCheckedAll(this,'isCheckedCopy');" >复制</span></td>
						<td class="tdattribute"><span id="span_ENABLE"><input type="checkbox" name="isCheckedEnableAll" id="isCheckedEnableAll" onclick="isCheckedAll(this,'isCheckedEnable');" >启用/通过</span></td>
						<td class="tdattribute"><span id="span_UNENABLE"><input type="checkbox" name="isCheckedUnEnableAll" id="isCheckedUnEnableAll" onclick="isCheckedAll(this,'isCheckedUnEnable');" >停用/不通过</span></td>
						<td class="tdattribute"><span id="span_CHECKBOX"><input type="checkbox" name="isCheckedCheckBoxAll" id="isCheckedCheckBoxAll" onclick="isCheckedAll(this,'isCheckedCheckBox');" >列表复选框</span></td>
<%--						<s:iterator value="getCodeItemList('operation_right')">--%>
<%--						<td class="tdattribute"><span id="span_<s:property value="value"/>"><input type="checkbox" name="isChecked<s:property value="value"/>All" id="isChecked<s:property value="value"/>All" onclick="isCheckedAll(this,'isChecked<s:property value="value"/>');" > <s:property value="name"/></span></td>--%>
<%--						</s:iterator>--%>
					</tr>
					</thead>
					<tbody class="stripe"> 
					<s:set name="parentNameTemp" value="''"/>
					<s:iterator value="blockRightList" id="blockRight" status="st">
					<tr>
						<s:if test="%{#attr.blockRight.parentName!=#parentNameTemp}">
						<s:set name="parentNameTemp" value="%{#attr.blockRight.parentName}"/>
						<%
							HashMap map = (HashMap)request.getAttribute("parentNameMap");
							String parentName = (String)request.getAttribute("parentNameTemp");
							String counts = String.valueOf(map.get(parentName));
						%>
						<td class="tdcontectleft" rowspan="<%=counts %>">
							<s:property value="parentName"/>
						</td>
						</s:if>
						<td class="tdcontect">
							<s:property value="blockName"/>
						</td>
						
						
						<td class="tdcontect">
							<input type="checkbox" name="isCheckedAdd<s:property value="blockNum"/>"
							id="isCheckedAdd<s:property value="blockNum"/>" value="1" <s:if test="%{#attr.blockRight.addRight==1}">checked</s:if >>
						</td>
						<td class="tdcontect">
							<input type="checkbox" name="isCheckedModify<s:property value="blockNum"/>"  onclick="isCheckedModify(this,'<s:property value="blockNum"/>');" 
							id="isCheckedModify<s:property value="blockNum"/>" value="1" <s:if  test="%{#attr.blockRight.modifyRight==1}">checked</s:if> <s:if test="%{#attr.blockRight.modifyRight==0&&#attr.blockRight.viewRight==1}"> disabled="disabled"</s:if>>
						</td>
						<td class="tdcontect">
							<input type="checkbox" name="isCheckedDel<s:property value="blockNum"/>"
							id="isCheckedDel<s:property value="blockNum"/>" value="1" <s:if  test="%{#attr.blockRight.delRight==1}">checked</s:if>>
						</td>
						<td class="tdcontect">
							<input type="checkbox" name="isCheckedView<s:property value="blockNum"/>"  onclick="isCheckedView(this,'<s:property value="blockNum"/>');" 
							id="isCheckedView<s:property value="blockNum"/>" value="1" <s:if  test="%{#attr.blockRight.viewRight==1}">checked</s:if> <s:if test="%{#attr.blockRight.modifyRight==1&&#attr.blockRight.viewRight==0}"> disabled="disabled"</s:if>>
						</td>
						<td class="tdcontect">
							<input type="checkbox" name="isCheckedEditSelect<s:property value="blockNum"/>"
							id="isCheckedEditSelect<s:property value="blockNum"/>" value="1" <s:if test="%{#attr.blockRight.editSelectRight==1}">checked</s:if>>
						</td>
						<td class="tdcontect">
							<input type="checkbox" name="isCheckedImportExcel<s:property value="blockNum"/>"
							id="isCheckedImportExcel<s:property value="blockNum"/>" value="1" <s:if test="%{#attr.blockRight.importExcelRight==1}">checked</s:if>>
						</td>
						<td class="tdcontect">
							<input type="checkbox" name="isCheckedExportExcel<s:property value="blockNum"/>"
							id="isCheckedExportExcel<s:property value="blockNum"/>" value="1" <s:if test="%{#attr.blockRight.exportExcelRight==1}">checked</s:if>>
						</td>
						<td class="tdcontect">
							<input type="checkbox" name="isCheckedCopy<s:property value="blockNum"/>"
							id="isCheckedCopy<s:property value="blockNum"/>" value="1" <s:if test="%{#attr.blockRight.copyRight==1}">checked</s:if>>
						</td>
						<td class="tdcontect">
							<input type="checkbox" name="isCheckedEnable<s:property value="blockNum"/>"
							id="isCheckedEnable<s:property value="blockNum"/>" value="1" <s:if test="%{#attr.blockRight.enableRight==1}">checked</s:if>>
						</td>
						<td class="tdcontect">
							<input type="checkbox" name="isCheckedUnEnable<s:property value="blockNum"/>"
							id="isCheckedUnEnable<s:property value="blockNum"/>" value="1" <s:if test="%{#attr.blockRight.unEnableRight==1}">checked</s:if>>
						</td>
						<td class="tdcontect">
							<input type="checkbox" name="isCheckedCheckBox<s:property value="blockNum"/>"
							id="isCheckedCheckBox<s:property value="blockNum"/>" value="1" <s:if test="%{#attr.blockRight.checkBoxRight==1}">checked</s:if>>
						</td>
					</tr>
					</s:iterator>
					</tbody>
	             </table>
             </td>
         </tr>
	</table>
	</s:form>
  
  </body>
</html>
